package com.sharp.demo.dao.entity;

import com.sharp.framework.dao.entity.Dictionary;
import com.sharp.framework.dao.entity.DictionaryItem;
import com.sharp.kernel.mybatis.join.anno.JoinCollection;
import com.sharp.kernel.mybatis.join.entity.IJoinRelationship;
import com.sharp.kernel.mybatis.join.entity.JoinRelationship;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Table;
import java.util.List;

/**
 * Title: DictionaryIdJoinItem
 * Description: Copyright: Copyright (c) 2019 Company: BHFAE
 *
 * @author Sharp
 * @date 2022/7/4 11:36
 */
@Data
@Table(name = "co_dictionary")
@EqualsAndHashCode(callSuper = true)
public class DictionaryIdJoinItem extends Dictionary implements IJoinRelationship {

    @JoinCollection
    private List<DictionaryItem> dictionaryItemList;


    @Override
    public List<JoinRelationship> joinRelationship() {
        return buildJoinRelationship(Dictionary.class, "dictionaryId", DictionaryItem.class, "dictionaryId", JoinRelationship.Type.LEFT_JOIN)
                .build();
    }
}
